package com.core.ui.controls;

public class ControlTextArea
        extends UIControl {

	private String  caption;
	private String  formFieldName;
	private String  data;
	private boolean readonly  = false;
	private int     rowsCount = 9;



	public int getRowsCount () {

		return rowsCount;
	}



	public void setRowsCount ( int rowsCount ) {

		this.rowsCount = rowsCount;
	}



	public boolean isReadonly () {

		return readonly;
	}



	public void setReadonly ( boolean readonly ) {

		this.readonly = readonly;
	}



	public String getCaption () {

		return caption;
	}



	public void setCaption ( String caption ) {

		this.caption = caption;
	}



	public String getFormFieldName () {

		return formFieldName;
	}



	public void setFormFieldName ( String formFieldName ) {

		this.formFieldName = formFieldName;
	}



	public String getData () {

		return data;
	}



	public void setData ( String data ) {

		this.data = data;
	}



	@Override
	public String toString () {

		String result = null;

		if ( readonly ) {
			result = String.format("<strong class=\"name\">%s</strong>%s", this.caption, this.data);

		} else {
			result = String.format(
			        "<strong class=\"name\">%s</strong><textarea rows=\"%d\" name=\"%s\">%s</textarea>",
			        this.caption,
			        this.rowsCount,
			        this.formFieldName,
			        this.data);
		}

		return result;
	}
}
